<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_CreateTable_School extends CI_Migration
{
    public function up()
    {
        $this->dbforge->add_field('id');
        $this->dbforge->add_field(array(
            'name'      => array('type' => 'VARCHAR', 'constraint' => '50'),
            'unicode'      => array('type' => 'int', 'constraint' => '5'),
            'country'   => array('type' => 'VARCHAR', 'constraint' => '20', 'null' => TRUE,),
            'province'  => array('type' => 'VARCHAR', 'constraint' => '20', 'null' => TRUE,),
            'city'      => array('type' => 'VARCHAR', 'constraint' => '20', 'null' => TRUE,),
            'region'    => array('type' => 'VARCHAR', 'constraint' => '20', 'null' => TRUE,),
            'address'   => array('type' => 'VARCHAR', 'constraint' => '50', 'null' => TRUE,),
            'auth_type' => array('type' => 'INT', 'constraint' => '9', 'null' => TRUE,),
            'ip_range' => array('type' => 'VARCHAR','constraint' => '160', 'null' => TRUE,),
        ));
        $this->dbforge->add_key('unicode', TRUE);
        $this->dbforge->create_table('school');
    }

    public function down()
    {
        $this->dbforge->drop_table('school');
    }
} 